package com.zeng.ssm.service.support.trans.client.core.acctNoQuery;

import cn.hutool.core.lang.Assert;
import com.zeng.ssm.service.support.trans.GxpConstant;
import com.zeng.ssm.service.support.trans.annotation.ClientHandler;
import com.zeng.ssm.service.support.trans.base.model.IBody;
import com.zeng.ssm.service.support.trans.client.base.BaseGxpClientHandler;
import com.zeng.ssm.service.support.trans.client.core.acctNoQuery.model.AcctNoQueryTransComponent;
import com.zeng.ssm.service.support.trans.client.core.acctNoQuery.model.in.AcctNoQueryInput;
import com.zeng.ssm.service.support.trans.client.core.acctNoQuery.model.out.AcctNoQueryOutput;
import org.springframework.util.ClassUtils;

/**
 * 账户信息查询
 *
 * @author zengwanlin
 * @date 2023-09-01T11:49
 */
@ClientHandler(sysCode = GxpConstant.SYS_CODE_CORE, msgCode = GxpConstant.MSG_CODE_CORE_0001, msgName = "账户信息查询", unRepeatable = false, loggingType = ClientHandler.LoggingType.TABLE)
public class AcctNoQueryHandler extends BaseGxpClientHandler {

    /**
     * 组装请求体
     *
     * @return
     */
    @Override
    protected IBody buildRequestBody() {
        Assert.isTrue(ClassUtils.isAssignableValue(AcctNoQueryTransComponent.class, component), "交易组件类型错误，请使用：%s", AcctNoQueryTransComponent.class.getSimpleName());
        AcctNoQueryTransComponent acctNoQueryComponent = (AcctNoQueryTransComponent) component;
        Assert.notEmpty(acctNoQueryComponent.getAcctNo(), "账号不能为空");

        AcctNoQueryInput input = new AcctNoQueryInput();
        input.setAcctNo(acctNoQueryComponent.getAcctNo());
        return input;
    }

    /**
     * 获取响应实体类Class
     *
     * @return
     */
    @Override
    protected Class<? extends IBody> getResponseBodyClass() {
        return AcctNoQueryOutput.class;
    }

}
